package Task1;

import java.util.ArrayList;

public class EmailService {
	public final static int n = 2;

	public static void main(String[] args) {
		ArrayList<Email> emailListToSend = new ArrayList<>();
		emailListToSend.add(new Email("Ivavanov"));
		emailListToSend.add(new Email("Petrov"));
		emailListToSend.add(new Email("Sidorov"));
		Queue queue1 = new Queue(emailListToSend);

		ArrayList<Email> emailListToAdd = new ArrayList<>();
		emailListToAdd.add(new Email("Egorov"));
		emailListToAdd.add(new Email("Andreev"));
		emailListToAdd.add(new Email("Astafiev"));

		for (int i = 0; i < n; i++) {
			new Thread(new EmailAdder(queue1, emailListToAdd)).start();
		}
		new Thread(new EmailSender(queue1)).start();

	}

}
